package com.anniljing.kotlionlearn.Basic.classes


open class TV {
    open fun turnOn() {
        println("Tv")
    }
}

class XiaoMiTV1 : TV() {
    val name="小米电视"
    override fun turnOn() {
        println("Open Xiaomi tv")
    }
}

class Controller<T> {
    fun turnOn(tv: T) {
        println("万能遥控打开")
    }
}

fun buy(controller: Controller<XiaoMiTV1>) {
    val xiaoMiTV1 = XiaoMiTV1()
    // 打开小米电视1
    controller.turnOn(xiaoMiTV1)
}

fun main() {
    val controller = Controller<XiaoMiTV1>()
    buy(controller)
}